//
// Created by root on 4/29/17.
//

#include "../runner.h"

// read_internal -> eval_internal
static void test_op_toplevel() {
    op_toplevel(global_scheme);
    ASSERT_OP_IN_STACK(eval_internal);
    ASSERT_OP_CURRENT(read_internal);
}

static void test_op_eval_internal() {
    op_eval_internal(global_scheme);
    ASSERT_OP_CURRENT(eval);
}





static void test_op_eval() {
    assert_string_equal(interpret("(eval '(+ 1 2))"), "3.000000");
    assert_string_equal(interpret("(eval '(+ 1 2) (interaction-environment))"), "3.000000");
}

static void test_op_apply() {
    assert_string_equal(interpret("(apply + '(1 2))"), "3.000000");
}

//TODO
static void test_op_quote() {
    assert_string_equal(interpret("'(1 2 3 . 4)"), "(1 2 3 . 4)");
}

int main(int argc, char **argv) {
    const struct CMUnitTest tests[] = {
            cmocka_unit_test(test_op_toplevel),
    };
    return cmocka_run_group_tests(tests, setup_scheme, teardown_scheme);
}
